﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThouShaltNotBrick.Models;
using Microsoft.Xna.Framework.Content;

namespace ThouShaltNotBrick.PipelineExtension.Readers
{
    public sealed class CampaignsContentTypeReader : ContentTypeReader<CampaignsData>
    {
        #region Overriden Methods
        protected override CampaignsData Read(ContentReader pInput, CampaignsData pExistingInstance)
        {
            // NUMBER OF CAMPAIGNS (int)
            //   NAME (string)

            int numCampaigns = pInput.ReadInt32();
            List<string> campaignList = new List<string>(numCampaigns);
            for (int i = 0; i < numCampaigns; i++)
            {
                string campaignName = pInput.ReadString();
                campaignList.Add(campaignName);
            }

            CampaignsData campaignsData = new CampaignsData(campaignList);
            return campaignsData;
        }
        #endregion
    }
}